// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_COMMON_TEXT_DIRECTION_MOJOM_SHARED_INTERNAL_H_
#define MOJO_COMMON_TEXT_DIRECTION_MOJOM_SHARED_INTERNAL_H_

#include <stdint.h>

#include "mojo/public/cpp/bindings/lib/array_internal.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/buffer.h"
#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
#include "mojo/public/cpp/bindings/lib/native_enum_data.h"
#include "mojo/public/cpp/bindings/lib/native_struct_data.h"

namespace mojo {
namespace internal {
    class ValidationContext;
}
}
namespace mojo {
namespace common {
    namespace mojom {
        namespace internal {

            struct TextDirection_Data {
            public:
                static bool constexpr kIsExtensible = false;

                static bool IsKnownValue(int32_t value)
                {
                    switch (value) {
                    case 0:
                    case 1:
                    case 2:
                        return true;
                    }
                    return false;
                }

                static bool Validate(int32_t value,
                    mojo::internal::ValidationContext* validation_context)
                {
                    if (kIsExtensible || IsKnownValue(value))
                        return true;

                    ReportValidationError(validation_context,
                        mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE);
                    return false;
                }
            };

#pragma pack(push, 1)

#pragma pack(pop)

        } // namespace internal
    } // namespace mojom
} // namespace common
} // namespace mojo

#endif // MOJO_COMMON_TEXT_DIRECTION_MOJOM_SHARED_INTERNAL_H_